<%-- 
    Document   : viewOrderDetails
    Created on : Dec 4, 2013, 3:17:29 PM
    Author     : Thai Ha Cong
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta name="description" content="Customer's Order Details - Online Shopping System">
        <title>Order Details</title>
        <link href="<%= request.getContextPath()%>/css/style.css" rel="stylesheet" type="text/css"/>
    </head>
    <body>
        <div class="headerbg">
            <%@include file="/include/iHeader.jsp" %>
        </div>
        <div class="contentbg">
            <s:if test="%{#session.currentCustomer == null}">
                <% response.sendRedirect(request.getContextPath() + "/home");%>
            </s:if>
            <s:else>
                <div class="content1">
                    <div class="content2">
                        <div class="contentLeft">
                            <div class="categories">
                                <div class="allCat">Control Panel</div>

                                <%@include file="/include/iProfileMenu.jsp" %>
                            </div>
                        </div>
                        <div class="contentRight">
                            <div class="body">
                                <div class="breadcrumb">
                                    <s:url namespace="/" action="home" var="homeUrl"></s:url>
                                    <s:url namespace="/Member" action="viewProfile" var="memberUrl"></s:url>
                                    <s:url namespace="/Member" action="viewOrders" var="viewOrdersUrl"></s:url>
                                    
                                    <s:a href="%{homeUrl}" title="Home" theme="simple">Home</s:a>
                                        >>
                                    <s:a href="%{memberUrl}" title="Member" theme="simple">Member Profile</s:a>
                                        >>
                                    <s:a href="%{viewOrdersUrl}" title="Member" theme="simple">View Orders</s:a>
                                        >>    
                                        Order Details
                                    </div>
                                    <div class="bodyUpper">
                                    <s:actionmessage />
                                    <h1>Your Order Details</h1>

                                    <table>
                                        <tr>
                                            <td style="text-align: left; width: 320px;">Order ID: <b><s:property value="order.idOrder"/></b></td>
                                            <td style="text-align: right; width: 320px;">Status: <b><s:property value="order.orderStatus"/></b></td>
                                        </tr>
                                        <tr>
                                            <td style="text-align: left;">Subtotal: <b>$<s:property value="order.totalAmount"/></b></td>
                                            <td style="text-align: right;">
                                                <s:if test="%{order.orderStatus.equals('Processing')}">
                                                    <s:form namespace="/Member" action="cancelOrder" theme="simple" cssStyle="display: inline;">
                                                        <s:hidden name="idOrder" value="%{order.idOrder}"/>
                                                        <s:submit value="Cancel" theme="simple"/>
                                                    </s:form>
                                                </s:if>
                                            </td>
                                        </tr>
                                    </table>
                                        
                                    <table class="orderDetails">
                                        <tr>
                                            <th class="odName">Product Description</th>
                                            <th class="odQty">Quantity</th>
                                            <th class="odPrice">Price</th>
                                            <th class="odAmount">Total Price</th>
                                        </tr>

                                        <s:iterator value="order.orderitemList" status="i">
                                            <s:if test="#i.index % 2 == 1">
                                                <tr class="evenRow">
                                                    <td class="odName">
                                                        <div class="productTinyImage">
                                                            <img src="/OnlineShopping/<s:property value="product.imageurl"/>" alt="img" width="64" height="auto">
                                                        </div>
                                                        <div class="productInfoOrder">
                                                            <s:url namespace="/" action="product/%{product.idProduct}/%{product.name.replaceAll('-', ' ')}" var="productUrl">
                                                            </s:url>
                                                            <s:a href="%{productUrl}" title="View Product Details" theme="simple"><s:property value="product.name"/></s:a>
                                                        </div>
                                                    </td>
                                                    <td class="odQty">
                                                        <s:property value="orderQuantity"/>
                                                    </td>
                                                    <td class="odPrice">
                                                        $<s:property value="orderPrice"/>
                                                    </td>
                                                    <td class="odAmount">
                                                        $<s:property value="orderPrice * orderQuantity"/>
                                                    </td>
                                                </tr>
                                            </s:if>
                                            <s:else>
                                                <tr class="oddRow">
                                                    <td class="odName">
                                                        <div class="productTinyImage">
                                                            <img src="/OnlineShopping/<s:property value="product.imageurl"/>" alt="img" width="64" height="auto">
                                                        </div>
                                                        <div class="productInfoOrder">
                                                            <s:url namespace="/" action="product/%{product.idProduct}/%{product.name.replaceAll('-', ' ')}" var="productUrl">
                                                            </s:url>
                                                            <s:a href="%{productUrl}" title="View Product Details" theme="simple"><s:property value="product.name"/></s:a>
                                                        </div>
                                                    </td>
                                                    <td class="odQty">
                                                        <s:property value="orderQuantity"/>
                                                    </td>
                                                    <td class="odPrice">
                                                        $<s:property value="orderPrice"/>
                                                    </td>
                                                    <td class="odAmount">
                                                        $<s:property value="orderPrice * orderQuantity"/>
                                                    </td>
                                                </tr>
                                            </s:else>
                                        </s:iterator>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </s:else>
        </div>
        <div class="footerbg">
            <%@include file="/include/iFooter.jsp" %>
        </div>
    </body>
</html>
